<?php use_helper('PA_Links') ?>
<?php if(isset($form)): ?>
<?php echo $form->renderFormTag(link_to_app('Store', 'updateOrder', array('id' => $order->getId())), array('id' => 'orderForm')) ?>
<input type="hidden" name="id" value="<?php echo $sf_request->getParameter('id') ?>" />
<table id="storeOrderTable" style="display: inline-table">
  <tr>
    <th>Zamówienie</th>
    <td colspan="3"><?php echo $order->getNumber() ?></td>
  </tr>
  <tr>
    <th>Projekt</th>
    <td colspan="3"><?php echo $order->getDemand()->getProject() ? : "Brak danych" ?></td>
  </tr>
  <tr>
    <th>Adres dostawy</th>
    <td colspan="3"><?php echo $order->getTargetAddress() ?></td>
  </tr>
  <tr>
    <th>Lp</th>
    <th style="min-width: 250px;">Materiał</th>
    <th>Ilość [<?php echo $orderItems->getFirst()->getStoreItem()->getCategory()->getQuantityUnit() ?>]</th>
    <th>
      <span class="middle">Aktualizuj wszystkie 
        <input type="checkbox" name="update_all" class="middle" checked="checked" onclick="App.Form.toggleDisable('input', 'items_list_values')" />
      </span>
    </th>
  </tr>
  <?php foreach($orderItems as $item): ?>
    <tr>
      <td><p id="counter"></p></td>
      <td><?php echo $item->getStoreItem()->getName() ?></td>
      <td><?php echo $item->getOrderedValue() ?></td>
      <td>
        <?php if($item->getOrderedValue() > $item->getSuppliedValue()): ?>
        <?php echo $form['items_list_values']->render(array('name' => 'items_list_values['.$item->getStoreItem()->getId().']', 'disabled' => 'disabled', 'value' => $item->getSuppliedValue())) ?>
        <?php else: ?>
        <?php echo $item->getSuppliedValue() ?>
        <?php endif; ?>
      </td>
    </tr>
  <?php endforeach; ?>
  <tr>
    <td colspan="4">
      <input type="button" value="Wyślij" onclick="App.Form.submit('orderForm', true)" />
    </td>
  </tr>
</table>
<?php else: ?>
Błąd formularza.
<?php endif; ?>